package org.aristotle.user.component;

import lombok.extern.slf4j.Slf4j;
import org.aristotle.user.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class InitRolesCacheRunner implements CommandLineRunner {

    @Autowired
    private IPermissionService permissionService;

    @Override
    public void run(String... args) {
        log.info("初始化角色缓存机");
        if (permissionService.refreshAuthRule()) {
            log.info("初始化缓存机成功");
        } else {
            log.info("初始化缓存机失败");
        }
    }
}
